import heapq
from typing import List


class Solution:
    def getFinalState(self, nums: List[int], k: int, multiplier: int) -> List[int]:
        heap=[(nums[i],i) for i in range(len(nums))]
        # 把列表转换为堆
        heapq.heapify(heap)
        for _ in range(k):
            # 每次取出 最小值的一个元素
            x,i=heapq.heappop(heap)
            nums[i]=x*multiplier
            # 进行操作后加入元素
            heapq.heappush(heap,(x*multiplier,i))
        return nums
